package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Resource
    private IFollowService followService;
    @PutMapping("/{concernUserId}/{isConcern}")
    public Result concernUser(@PathVariable("concernUserId") Long concernUserId, @PathVariable("isConcern") Boolean isConcern) {
        return followService.concernUser(concernUserId, isConcern);
    }

    @GetMapping("/or/not/{id}")
    public Result isConcernOrNot(@PathVariable("id") Long userId) {
        return followService.isConcernOrNot(userId);
    }

    /**
     * 查看当前登录用户和关注用户的共同关注
     */
    @GetMapping("/common/{concernUserId}")
    public Result commonConcern(@PathVariable("concernUserId") Long concernUserId) {
        return followService.commonConcern(concernUserId);
    }
}
